package com.woniuxy.gateway.config;

import org.springframework.stereotype.Component;
import springfox.documentation.swagger.web.SwaggerResource;
import springfox.documentation.swagger.web.SwaggerResourcesProvider;

import java.util.Arrays;
import java.util.List;

@Component
public class SwaggerSourceConfig implements SwaggerResourcesProvider {

	/**
	 * 下拉列表里面的资源列表配置
	 */
	@Override
	public List<SwaggerResource> get() {
		return Arrays.asList(
			createResource("/user/v2/api-docs","用户服务"),
			createResource("/order/v2/api-docs","订单服务"),
			createResource("/product/v2/api-docs","产品服务"),
			createResource("/admin/v2/api-docs","管理员服务"),
			createResource("/course/v2/api-docs","课程服务"),
			createResource("/coach/v2/api-docs","教练服务"),
			createResource("/comment/v2/api-docs","评论服务"),
			createResource("/venue/v2/api-docs","场馆服务"),
			createResource("/card/v2/api-docs","会员卡服务"),
			createResource("/count/v2/api-docs","统计服务"),
			createResource("/process/v2/api-docs","流程服务")
		);
	}

	private SwaggerResource createResource(String url,String name) {
		SwaggerResource sr = new SwaggerResource();
		sr.setLocation(url);
		sr.setName(name);
		sr.setSwaggerVersion("2.0");
		return sr;
	}

}